home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Games Collection 1
/
software vault.zip
/
software vault
/
CDR10
/
SPX20.ZIP
/
SPX_DOC.ZIP
/
SPX_DOS.DOC
< prev
next >
Wrap
Text File
|
1993-09-15
|
3KB
|
89 lines
{ SPX Library Version 2.0 Copyright 1993 Scott D. Ramsay }
SPX_DOS is a generic file and memory handling unit.
───────────────────────────────────────────────────────────────────────────
function OpenDos(FileName:string):word;
Open a file for reading.
FILENAME: File to read
Returns a handle to the open file or 0 if an error
───────────────────────────────────────────────────────────────────────────
procedure ReadDos(Handle:word;Buffer:pointer;var size:word;Var Error:byte);
Read data from a file opened from OpenDos
HANDLE: handle to the open file
BUFFER: pointer to the buffer to store the data
SIZE: number of bytes to read
ERROR: 0 no error, or dos error code
───────────────────────────────────────────────────────────────────────────
procedure SeekDos(Handle:word;position:longint);
Change the file position of the file.
HANDLE: handle to the open file
POSITION: the absolute positon of the file (in bytes)
───────────────────────────────────────────────────────────────────────────
function PosDos(Handle:word):longint;
Returns the current position of the file (in bytes).
HANDLE: handle to the open file.
───────────────────────────────────────────────────────────────────────────
procedure CloseDos(var Handle:word);
Closes an open file.
HANDLE: handle to the file to close
───────────────────────────────────────────────────────────────────────────
function malloc(size:word):pointer;
Allocates memory up to 64k bytes. Uses the TP heap space. Does memory
checking.
SIZE: The number of bytes to allocate
Returns a pointer to the memory block or NIL if could not allocate
memory.
You can use freely with GetMem/FreeMem. Do not use with MARK/RELEASE.
───────────────────────────────────────────────────────────────────────────
procedure free(var p:pointer);
Deallocte a memory block allocated from malloc.
P: Pointer to the memory block to be freed.
Returns P := NIL
You can use freely with GetMem/FreeMem. Do not use with MARK/RELEASE.
───────────────────────────────────────────────────────────────────────────
function GetPtr(p:pointer;offset:longint):pointer;
Creates a new pointer at P+offset. Adjusts for segment boundries.
Returns the new pointer location. Note: offset MUST be positive or zero.
P: pointer to adjust
OFFSET: offset for the pointer (in bytes)
EXAMPLE:
var
p : pointer;
p := GetPtr(SomePointer,88000);
{ p points to 88000 bytes past SomePointer }
───────────────────────────────────────────────────────────────────────────